package info.aquaball.service.tourservice;

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.KeyFactory;

import info.aquaball.data.Tour;

public class TourServiceImpl implements TourService{

	DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
	
	@Override
	public void createTour(Tour tour) {
		Entity tourEntity = new Entity("Tour");
		tourEntity.setProperty("name", tour.getName());
		datastore.put(tourEntity);
		tour.setId(KeyFactory.keyToString(tourEntity.getKey()));		
	}

	@Override
	public void deleteTour(String id) {
		datastore.delete(KeyFactory.stringToKey(id));			
	}

}
